<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="Mark Otto, Jacob Thornton, and Bootstrap contributors">
    <meta name="generator" content="Hugo 0.108.0">
    <title>Signin Template · Bootstrap v5.3</title>
    <link rel="icon" type="image/png" href="images/favicon.png">
    <link rel="canonical" href="https://getbootstrap.com/docs/5.3/examples/sign-in/">
    <link href="css/bootstrap.min.css" rel="stylesheet">

    <style>
        .bd-placeholder-img {
            font-size: 1.125rem;
            text-anchor: middle;
            -webkit-user-select: none;
            -moz-user-select: none;
            user-select: none;
        }

        @media (min-width: 768px) {
            .bd-placeholder-img-lg {
                font-size: 3.5rem;
            }
        }

        .b-example-divider {
            height: 3rem;
            background-color: rgba(0, 0, 0, .1);
            border: solid rgba(0, 0, 0, .15);
            border-width: 1px 0;
            box-shadow: inset 0 .5em 1.5em rgba(0, 0, 0, .1), inset 0 .125em .5em rgba(0, 0, 0, .15);
        }

        .b-example-vr {
            flex-shrink: 0;
            width: 1.5rem;
            height: 100vh;
        }

        .bi {
            vertical-align: -.125em;
            fill: currentColor;
        }

        .nav-scroller {
            position: relative;
            z-index: 2;
            height: 2.75rem;
            overflow-y: hidden;
        }

        .nav-scroller .nav {
            display: flex;
            flex-wrap: nowrap;
            padding-bottom: 1rem;
            margin-top: -1px;
            overflow-x: auto;
            text-align: center;
            white-space: nowrap;
            -webkit-overflow-scrolling: touch;
        }
    </style>

    <script>
        const password_format='^(?=.*[A-Za-z])(?=.*\\d)[A-Za-z\\d]{8,}$\n'
        const email_format='^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$'
        var be=false;
        function regex_password(password){
            return !!password_format.test(password);
        }
        function regex_email(email){
            return !!email_format.test(email);
        }

        var email=document.getElementById("mail");
        email.addEventListener(
            "input",function (event){
            if(regex_email(email.value)){
                email.setCustomValidity("");
                be=true;
            }else{
                email.setCustomValidity("邮箱格式错误");
                be=false;
            }
        })
        function submitForm(){
            $.ajax({
                type:"post",
                url:"/user/regiter",
                data:$("#myform").serialize(),//将表单数据序列化
                async:false,
                success:function (data){
                    if(data.code==200){
                        alert("注册成功");
                        window.location.href="index.html";
                    }else{
                        alert("注册失败");
                    }
                }
            })
        }
    </script>
    <!-- Custom styles for this template -->
    <link href="css/sign-in.css" rel="stylesheet">
</head>
<body class="text-center">

<main class="form-signin w-100 m-auto">
    <form id=myform>

        <img class="mb-4" src="images/love.png" alt="" width="72" height="57">
        <h1 class="h3 mb-3 fw-normal">Already sign up</h1>

        <div class="form-floating">
            <input type="email" class="form-control" id="mail" placeholder="name@example.com">
            <label for="mail">Email address</label>
            <span class="error" aria-live="polite"></span>
        </div>
        <hr>
        <div class="form-floating">
            <input type="password" class="form-control" id="password" placeholder="Password">
            <label for="password">Password</label>
            <span class="error" aria-live="polite"></span>
        </div>
        <div class="form-floating">
            <input type="password" class="form-control" id="password_confirm" placeholder="Password">
            <label for="password_conirm">Confirm Password</label>
            <span class="error" aria-live="polite"></span>
        </div>

        <button class="w-100 btn btn-lg btn-primary" type="submit" onclick="submitForm">Sign up</button>
        <p class="mt-5 mb-3 text-muted">&copy; 2023–2024</p>
    </form>
</main>



</body>
</html>
